package com.yfbao.horizon.sacn;

import lombok.Data;

import java.util.List;

@Data
public class ClassMethodStat {
    private String className;
    private String classSimpleName;
    private String methodName;
    private String returnValueType;
    private long returnLength;
    private long returnLenKB;
    private long returnLenMb;

    public void setParams(List<String> params) {
        this.params = params;
        if(params!=null){
            StringBuilder builder = new StringBuilder();
            for (String param : params) {
                builder.append(param).append(" , ");
            }
            this.paramsValue = builder.toString();
        }
    }

    private List<String> params;
    private String methodDesc;
    private String classDesc;

    public String getParamsValue() {
        if(this.params!=null){
            StringBuilder builder = new StringBuilder();
            for (String param : this.params) {
                builder.append(param).append(" , ");
            }
            this.paramsValue = builder.toString();
        }
        return paramsValue;
    }

    private String paramsValue;

    public long getReturnLenKB(){
        return returnLength/1024;
    }

    public long getReturnLenMb(){
        return returnLength/1024/1024;
    }
    public String toString(){
        return this.getClassName()+","+this.getMethodName()+","+this.getReturnValueType()+","+this.getReturnLength();
    }
//    public String toString(){
//        return this.getClassName()+","
//                +this.getClassDesc()+","
//                +this.getMethodDesc()+","
//                +this.getMethodName()+","
//                +this.getParams()+","
//                +this.getReturnValueType();
//    }
}
